using Framework.Singleton;

namespace Framework.Util
{
    public class PathUtil : Singleton<PathUtil>
    {
        private PathUtil() { }

        public string LinkPath(params string[] pPaths)
        {
            string fullPath = string.Empty;

            foreach (string path in pPaths)
            {
                string pathStr = path;
                if (path.StartsWith("/") || path.StartsWith("\\"))
                    pathStr = pathStr.Remove(0);

                if (path.EndsWith("/") || path.EndsWith("\\"))
                    pathStr = pathStr.Remove(pathStr.Length - 1);

                if (string.IsNullOrEmpty(fullPath))
                    fullPath = pathStr;
                else
                    fullPath = $"{fullPath}/{pathStr}";
            }

            return fullPath;
        }
    }
}